package org.example.wine.boot.controller;


import jakarta.servlet.http.HttpServletResponse;
import org.example.wine.boot.pojo.Result;
import org.example.wine.boot.utils.JwtUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;


@RestController
@RequestMapping("/article")
public class ArticleController {


    @GetMapping("/list")
    public Result<String> list(HttpServletResponse response, @RequestHeader("token") String token) {
        try {
            Map<String, Object> map = JwtUtils.parseToken(token);
            return Result.success("这是所有文字");
        } catch (Exception e) {
            response.setStatus(401);
            return Result.error("未登录");
        }
    }
}
